// $Id: mrecordset.h,v 1.3 2002/09/29 07:04:40 leon Exp $
// recordset.h: interface for the MRecordset class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MRECORDSET_H__17B60DEE_B37D_4B10_93E1_6B673C77F67E__INCLUDED_)
#define AFX_MRECORDSET_H__17B60DEE_B37D_4B10_93E1_6B673C77F67E__INCLUDED_

#include "str.h"	// Added by ClassView
#include "sql.h"
#include "listpage.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class MRecordset: public MListPage {
public:
	CLStr field(LPCSTR name);
	CLStr field(int index);
	MRecordset(CLSql* pdb) { mpSql = pdb; }
	virtual ~MRecordset() {}
	int IsErr() 	{	return !mpSql||!mErr.empty(); }
	int IsEmpty() 	{ 	return !mCurRow.length(); }
	int IsEof() 	{	return mCurPos>=mAllRow.length()||mCurPos<0; }
	int Next() 		{	Seek(++mCurPos); }
	int Seek(int pos);
	int OpenPage(LPCSTR SqlSelect,LPCSTR SqlFrom,int& CurPage,int RowPerPage);
	int Open(LPCSTR sql, int bWithPage=1);	
	void Clean();

	int mCurPos;
	CLSql* mpSql;
	CLStrList mAllRow;
	CLStrList mCurRow;
	CLStrList mField;
	CLStr 		mErr;
};

#endif // !defined(AFX_MRECORDSET_H__17B60DEE_B37D_4B10_93E1_6B673C77F67E__INCLUDED_)
